package com.bwie.rabbit;

import com.bwie.common.domain.LottoLog;
import com.bwie.mapper.LottoMapper;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class LottoLogMq {
    @Autowired
    private LottoMapper lottoMapper;


    @RabbitListener(queuesToDeclare = @Queue(name = "addLog"))
    public void addLog(LottoLog lottoLog){
        try {
            lottoMapper.addLog(lottoLog);
            System.out.println("成功处理消息"+lottoLog);
        } catch (Exception e) {
            System.err.println("发生消息失败"+e.getMessage());
        }
    }
}
